using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Dal.Entities;

namespace Dal.Mapping
{
	public class RegionMap : EntityTypeConfiguration<Region>
	{
		public RegionMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			this.Property(t => t.Code)
				.HasMaxLength(13);
				
			this.Property(t => t.Name)
				.HasMaxLength(100);
				
			this.Property(t => t.ChName)
				.HasMaxLength(50);
				
			this.Property(t => t.BriefName)
				.HasMaxLength(50);
				
			// Table & Column Mappings
			this.ToTable("Region");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.Code).HasColumnName("Code");
			this.Property(t => t.Name).HasColumnName("Name");
			this.Property(t => t.ChName).HasColumnName("ChName");
			this.Property(t => t.BriefName).HasColumnName("BriefName");
			this.Property(t => t.fid).HasColumnName("fid");
			this.Property(t => t.provinceid).HasColumnName("provinceid");
			this.Property(t => t.cityid).HasColumnName("cityid");
			this.Property(t => t.depth).HasColumnName("depth");
			this.Property(t => t.isbroad).HasColumnName("isbroad");
			this.Property(t => t.IsGov).HasColumnName("IsGov");
		}
	}
}

